package com.ptu.mapper;

import com.ptu.entity.ChatMessage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ChatMessageMapper {
    // 插入新消息
    int insert(ChatMessage message);

    // 获取用户间的历史消息
    List<ChatMessage> getMessagesBetweenUsers(
        @Param("sender") String sender,
        @Param("receiver") String receiver,
        @Param("limit") Integer limit
    );
    
    // 获取指定会话的历史消息
    List<ChatMessage> getMessagesBySessionId(@Param("sessionId") String sessionId);

} 